package com.example.demo.service;

import com.example.demo.dao.UserMapper;
import com.example.demo.model.Userinfo;
import com.example.demo.model.vo.UserinfoVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired //依赖注入(数据库实现接口)
    private UserMapper userMapper;
    public int reg(Userinfo userinfo){
        return userMapper.reg(userinfo);//只是调用一下操作数据库的方法,实现方法分离
    }
    public Userinfo getUserByName(String username){ ////通过username查询对象
        return userMapper.getUserByName(username);
    }
    //通过uid查询用户信息
    public UserinfoVO getUserById(int uid){
        return userMapper.getUserById(uid);
    }
}
